Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: dropdown content position does not react to content size #277

Merged
merged 1 commit into from
Apr 29, 2024

Conversation

AnotiaWang
Copy link
Contributor

fixes #276

Copy link

stackblitz bot commented Mar 16, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

netlify bot commented Mar 16, 2024

Deploy Preview for sensational-seahorse-8635f8 ready!

Name Link
🔨 Latest commit b5c4a57
🔍 Latest deploy log https://app.netlify.com/sites/sensational-seahorse-8635f8/deploys/65f552e0a757f9000815223f
😎 Deploy Preview https://deploy-preview-277--sensational-seahorse-8635f8.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@AnotiaWang
Copy link
Contributor Author

You can use this modified version of FwbDropdownExamplePlacement.vue to test:

<template>
  <div class="vp-raw flex gap-2 flex-wrap">
    <fwb-dropdown
      text="Dropdown"
      :placement="placement"
      close-inside
    >
      <fwb-list-group>
        <fwb-list-group-item
          v-for="i in items"
          :key="i"
        >
          {{ i }}
        </fwb-list-group-item>
      </fwb-list-group>
    </fwb-dropdown>
    <fwb-dropdown
      placement="top"
      text="Top"
    >
      <p class="p-2">
        Dropdown content here
      </p>
    </fwb-dropdown>
    <fwb-dropdown
      placement="right"
      text="Right"
    >
      <p class="p-2">
        Dropdown content here
      </p>
    </fwb-dropdown>
    <fwb-dropdown text="Bottom">
      <p class="p-2">
        Dropdown content here
      </p>
    </fwb-dropdown>
    <fwb-dropdown
      placement="left"
      text="Left"
    >
      <p class="p-2">
        Dropdown content here
      </p>
    </fwb-dropdown>
  </div>
</template>

<script setup>
import { FwbDropdown, FwbListGroup, FwbListGroupItem } from '../../../../src/index'
import { onUnmounted, ref } from 'vue'

const items = ref([])
const placement = ref('top')

// Click the dropdown to activate it before this timeout ends
const interval = setInterval(() => {
  if (items.value.length > 4) {
    items.value = []
  } else {
    items.value.push('1', '2', '3')
  }
  if (placement.value === 'top') placement.value = 'bottom'
  else if (placement.value === 'bottom') placement.value = 'left'
  else if (placement.value === 'left') placement.value = 'right'
  else placement.value = 'top'
}, 2000)

onUnmounted(() => clearInterval(interval))
</script>

Copy link
Collaborator

@Sqrcz Sqrcz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested it locally... works like a charm 👍

Thank you 🙏

@Sqrcz Sqrcz merged commit a506ce8 into themesberg:main Apr 29, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FwbDropdown content's position doesn't change with its width and height
2 participants